package com.hongsen.cn.contract;

import com.hongsen.cn.Utils.GsonUtils;
import com.hongsen.cn.application.DayAndMonthApplication;
import com.hongsen.cn.base.BaseModel;
import com.hongsen.cn.base.BaseObserver;
import com.hongsen.cn.base.BasePresenter;
import com.hongsen.cn.bean.TheKeyPersonelBean;
import com.hongsen.cn.presenter.OutOfLineView;

import java.util.List;

public class OutOfLinePresenter extends BasePresenter<OutOfLineView> {


    public OutOfLinePresenter(OutOfLineView baseView) {
        super(baseView);
    }

    /**
     * 重点人员
     */
    public void getTheKeyPersonel(final String type) {
        addDisposable(restApi.getTheKeyPersionel(type), new BaseObserver(baseView) {
            @Override
            public void onSuccess(Object o) {
                BaseModel<List<TheKeyPersonelBean>> model = (BaseModel<List<TheKeyPersonelBean>>) o;
                baseView.getTheKeyPersonel(type,model.getData());


                DayAndMonthApplication.getInstance().logger.debug(">>>indexBusiness/getInfo违规人员:" +
                        GsonUtils.getInstance().toJson(model));
            }

            @Override
            public void onError(String msg) {
                DayAndMonthApplication.getInstance().logger.debug(">>>indexBusiness/getInfo违规人员获取失败:" +
                        msg);
            }
        });
    }

}
